﻿/// <reference path="jquery-vsdoc.js" />
/// <reference path="jquery-ui-1.8.custom.min.js" />

// 设置widget的全局默认属性


$.datepicker.setDefaults(
{
    disable: 'true',
    dateFormat: 'yy-mm-dd',
    dateNames: ['星期天', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
    dayNamesMin: ['日', '一', '二', '三', '四', '五', '六'],
    dayNamesShort: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
    monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
    nextText: '下个月',
    prevText: '上个月',
    showOtherMonths: 'true',
    selectOtherMonths: 'true',
    showAnim: 'fadeIn',

    onSelect: function () {
    }
}
);
$.fn.qtip.defaults = {
    prerender: false,
    id: false,
    overwrite: true,
    content: {
        text: true,
        attr: 'title',
        title: {
            text: false,
            button: false
        }
    },
    position: {
        my: 'top left',
        at: 'bottom right',
        target: false,
        container: false,
        viewport: false,
        adjust: {
            x: 0, y: 0,
            mouse: true,
            resize: true
        },
        effect: true
    },
    show: {
        target: false,
        event: 'mouseenter',
        effect: true,
        delay: 90,
        solo: false,
        ready: false,
        modal: false
    },
    hide: {
        target: false,
        event: 'mouseleave',
        effect: true,
        delay: 0,
        fixed: false,
        inactive: false
    },
    style: {
        classes: 'qtip-text',
        widget: false,
        tip: {
            corner: true,
            mimic: false,
            width: 8,
            height: 8,
            border: true,
            offset: 0
        }
    },
    events: {
        render: null,
        move: null,
        show: null,
        hide: null,
        toggle: null,
        focus: null,
        blur: null
    }
};

EzDesk.DesktopWeb = GetDesktopWeb();
EzDesk.DesktopWeb.RefreshPageStyle = RefreshPageStyle;
function GetDesktopWeb() {
    var DesktopWeb = {};
    //todo:
    return DesktopWeb;
}

function RefreshPageStyle(tipCount) {
    if (!tipCount) tipCount = 0;

    if (tipCount == 0 &&
        ($('#tipsw').has('#shortcuts').length == 0 ||
            $('#tipsw').find('#shortcuts').children().length == 0)) {

        $('#contentw').width('100%');
        $('#tipsw').width('0');
    } else {
        $('#contentw').width('77%');
        $('#tipsw').width('23%');
    }
}

// 加载后执行

$(function () {
    $('input:text').textbox();
    $('input:password').textbox();
    $('textarea').textbox()
    //$('input:checkbox, input:radio').checkbox();

    $('.content-section-optional').each(function (index, item) {
        var _self = this;
        var entry = $('.entry-explanation', _self)[0];
        if (entry) {
            var content = $(entry).next();

            if ($(_self).attr('class').contains('content-default-hide')) {
                content.hide();
            }

            $(entry)
            .hover(function () {
                $(this).css({ 'cursor': 'pointer' });
            }, function () {
                $(this).css({ 'cursor': 'normal' });
            })
            .click(function () {
                content.toggle();
            });
        }
    });
    
});


 

